package com.yisu.expressway.api.core.service.impl;

import com.yisu.expressway.api.core.mapper.GoodsSpecificationMapper;
import com.yisu.expressway.api.core.service.IGoodsSpecificationService;
import com.yisu.expressway.api.domain.request.GoodsInfoRequest;
import com.yisu.expressway.ewf.entity.GoodsSpecification;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * /**
 * User: 赵杰
 * Date: 2017/5/10
 * Time: 15:02
 * Desc: .
 */
@Service
public class GoodsSpecificationServiceImpl implements IGoodsSpecificationService {
    @Resource
    private GoodsSpecificationMapper goodsSpecificationMapper;
    /**
     * 通过主键ID获取商品规格
     *
     * @param primaryId 主键ID
     * @return 商品规格信息
     */
    @Override
    public GoodsSpecification getGoodsSpecificationByPrimary(Long primaryId) {
        return goodsSpecificationMapper.selectByPrimaryKey(primaryId);
    }

    /**
     * 获取当前规格编号的下级列表数据，
     *
     * @param goodsInfoRequest 商品编号 当前规格编号 类目编号
     * @return
     */
    @Override
    public List<GoodsSpecification> getChildListByGoodsNoAndCategoryCode(GoodsInfoRequest goodsInfoRequest) {
        return goodsSpecificationMapper.getChildListByGoodsNoAndCategoryCode(goodsInfoRequest);
    }
}
